#! /bin/sh

WORKDIR=/gwserver

start_gateway() {
    PID=$(pgrep dicom)
    if [ $? -eq 0 ]; then 
        echo "Surcloud Gateway Server is running: $PID"
        return 0
    fi

    cd $WORKDIR
    dicom -x
    netstat -natp | grep dicom
    if [ $? -eq 0 ]; then
        echo "SurCloud Gateway Server start succesfully"
        return 0
    else
        echo "Failed to start SurCloud Gateway Server"
        return 1
    fi
}

start_gateway
